package test;

import org.antlr.runtime.ANTLRStringStream;
import org.antlr.runtime.CharStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.RecognitionException;

import real.RealSetConstructionLexer;
import real.RealSetConstructionParser;
import real.evaluation.Evaluator;
import real.lang.RealLangException;
import real.lang.RealSet;
import junit.framework.TestCase;
import junit.framework.Assert; 

public class SetconstrTestFormula extends TestCase {
	
	public void testDummyFormula() throws RealLangException
	{
		String formula = "forall x in X . exists y in X. x < y";
		String setConstruction = "x | " + formula; // {x | formula}
		
		// evaluation		
		CharStream input = new ANTLRStringStream(setConstruction);
		RealSetConstructionLexer lex = new RealSetConstructionLexer(input);
		CommonTokenStream tokens = new CommonTokenStream(lex);
		RealSetConstructionParser parser = new RealSetConstructionParser(tokens);			
		try {
			Evaluator eval = new Evaluator();
			RealSet set = parser.setConstruction().result.Evaluate(eval);
		} catch (RecognitionException e) {
			Assert.fail(e.toString());			
		}
	} 
	
}
